package cn.itcast.service.impl;

import cn.itcast.dao.ScDao;
import cn.itcast.domain.CourseAndSc;
import cn.itcast.domain.Sc;
import cn.itcast.service.ScService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Controller

public class ScServiceImpl implements ScService {

    @Autowired
    private ScDao scDao;
    public List<Sc> findByIdToSc(@Param("username")String username) {
        return scDao.findByIdToSc(username);
    }

    public void insertToSc(@Param("username")String username,
                           @Param("courseno")Integer courseno){
        scDao.insertToSc(username,courseno);
    }

    public List<CourseAndSc> findAllByStuId(@Param("username")String username) {
        return scDao.findAllByStuId(username);
    }

    public void deleteToSnoAndCourseno(@Param("username")String username,
                                       @Param("courseno")Integer courseno) {
        scDao.deleteToSnoAndCourseno(username, courseno);
    }


}
